package net.maku.generator.utils;

import cn.hutool.core.io.FileUtil;

import java.io.File;
/**
 * 通用文件操作类
 *
 * @author 代码小子 codeboy@126.com
 * @since 1.0.0 2024-11-09
 */
public class FileCommUtils {
    public static void move1(String sourcePath, String targetPath){
        File sourceFile =  new File(sourcePath);
        File targetFile =  new File(targetPath);

        targetFile.deleteOnExit();
        sourceFile.renameTo(targetFile);
    }

    public static void move(String sourcePath, String targetPath){
        File sourceFile =  new File(sourcePath);
        File targetFile =  new File(targetPath);
        try {
            FileUtil.move(sourceFile,targetFile,true);
            System.out.println("文件移动成功！");
        } catch (Exception e) {
            System.out.println("文件移动失败！");
        }
    }




}
